Data Representation
78 questions· page 1 of 8
Write a pseudocode statement to declare the enumerated data type, Vehicle, to hold the identity code of each of the company’s taxis:
M100, M230, T101, T102, T120, T150
...................................................................................................................................................
.............................................................................................................................................
Write pseudocode statements to declare the composite data type, Booking, to hold data about taxi bookings. The data required includes:
- booking number (any combination of letters and numbers)
- destination
- client name
- client telephone number
- date of departure
- address for pick-up
- the identity code of the taxi used.
Use the most appropriate data type in each case, including the enumerated data type from part (a).
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Write the normalised floating-point representation of the following binary number using this system.
0.00000011010111
Calculate the normalised binary floating-point representation of –25.3125 in this system.
Show your working.
Working .....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
The pseudocode algorithm checks whether a location in a stock file StockList.dat is empty or not. The location is given by the user. If the location is empty, a suitable message is displayed, otherwise the item stored at that location is displayed.
Complete this file-handling pseudocode algorithm.
DECLARE Location : INTEGER
DECLARE Item : STRING
DECLARE Continue : BOOLEAN
DECLARE Answer : CHAR
Continue ← TRUE
OPENFILE .......................................................................................................................................
WHILE Continue
OUTPUT "Enter a location between 1 and 500: "
INPUT Location
....................................................................................................................................................
GETRECORD ..............................................................................................................................
IF Item = "" THEN
OUTPUT "This record is missing."
ELSE
OUTPUT "The item in stock is ", ........................................................................
ENDIF
OUTPUT "Another location (Y or N)?"
INPUT Answer
IF Answer <> 'Y' THEN
Continue ← FALSE
ENDIF
ENDWHILE
..........................................................................................................................................................
OUTPUT "End of program"
Write pseudocode to store the following details to Flight1:
| Field | Data |
|---|---|
| FlightNumber | SB2789 |
| Destination | Dublin |
| FlightDate | 30/07/2025 |
| Gate | N03 |
| Airline | Cambridge Airways |
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Write a pseudocode statement to declare GateID to hold the identity codes for the airport gates:
N01, N02, N03, W01, W02, W03, W04
...........................................................................................................................................
.....................................................................................................................................
Write the new pseudocode statement required to replace the declaration of Gate in Departure.
.....................................................................................................................................
Calculate the normalised binary floating-point representation of +124.4375 in this system.
Show your working.
Working .....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Calculate the denary value of the following normalised binary floating-point number.
Show your working.
Working .....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Denary value ............................................................................................................................
The pseudocode algorithm below uses random file access to copy 50 records from a live file CurrentResults.dat to a stored file StoredResults.dat one record at a time. It uses the user-defined type StudentResult.
TYPE StudentResult
DECLARE LastName : STRING
DECLARE FirstName : STRING
DECLARE ExamGrade : STRING
ENDTYPE
If any grades are missing in CurrentResults.dat, the text "Missing grade" is added to the ExamGrade field in StoredResults.dat
Complete this file handling pseudocode algorithm.
DECLARE Grade : StudentResult
DECLARE Position : INTEGER
..........................................................................................................................
OPENFILE "StoredResults.dat" FOR RANDOM
..........................................................................................................................
FOR Position ← 1 TO 50
SEEK "CurrentResults.dat", Position
GETRECORD "CurrentResults.dat", Grade
IF Grade.ExamGrade = "" THEN
.............................................................................................................
ENDIF
....................................................................................................................
....................................................................................................................
NEXT Position
CLOSEFILE "CurrentResults.dat"
CLOSEFILE "StoredResults.dat"
Write pseudocode statements to declare the composite data type VideoLibrary to hold data about each video in the collection. This data includes:
• identity code (any combination of letters and numbers)
• title
• year released
• date purchased
• format (for example DVD, Blu-ray, 4K, MP4)
• running time (minutes)
Use the most appropriate data type in each case.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Identify one field in VideoLibrary that could be an efficient enumerated data type and give a reason for your choice.
Field ..........................................................................................................................................
...................................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
Give the largest normalised positive two’s complement binary number that can be stored in this system and state its denary equivalent.
The denary answer should be expressed in terms of powers of 2.
Denary ......................................................................................................................................
Calculate the normalised binary floating-point representation of –3.59375 in this system.
Show your working.
Working .....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
The pseudocode algorithm below allows a user to input a new stock item. The random file is searched for the next empty location in the file and the new item is inserted there.
A suitable message is displayed if the file is full.
Complete this pseudocode.
DECLARE Location : INTEGER
DECLARE NewStock : STRING
DECLARE CurrentStock : STRING
DECLARE Stored : BOOLEAN
DECLARE Max : INTEGER
Max ← 100000
Stored ← FALSE
Location ← 1
..........................................................................................................................
OUTPUT "Enter the new item you wish to store: "
INPUT NewStock
WHILE NOT Stored AND Location <= Max
....................................................................................................................
GETRECORD "StockList.dat", ..........................................................................................
IF CurrentStock = "" THEN
...................................................................................... "StockList.dat", NewStock
Stored ← TRUE
ELSE
Location ← Location + 1
ENDIF
ENDWHILE
................................................................................................................................................ THEN
OUTPUT "The new item has not been stored as the file was full."
ENDIF
CLOSEFILE "StockList.dat"
Write the pseudocode statement to set up a variable for one record of the composite data type, ClubMember.
...........................................................................................................................................
.....................................................................................................................................
Write the pseudocode statements to assign the following values to the variable set up in part (a)(i):
- 984632 to
Code TRUEtoFeesPaid
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.....................................................................................................................................
Write the pseudocode statement for the type declaration of Activity to hold the names of the available activities:
Badminton, Football, Golf, Snooker, Swimming, Tennis.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
.....................................................................................................................................
Write the new pseudocode statement required to update the declaration of Choice in the definition of ClubMember.
...........................................................................................................................................
.....................................................................................................................................